Skip to content

TYP: Inline typing annotations #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

TYP: Inline typing annotations #136

wants to merge 13 commits into from

Conversation

jorenham
Copy link
Member

@jorenham jorenham commented Apr 19, 2025

I intentionally annotated the input types to (also) accept the overly-loose numpy.typing.ArrayLike type. Because even though that also accepts invalid input, it would avoid breaking user code like

def get_rich_quick(p: npt.ArrayLike):
    r = npf.irr(p)
    # ???
    return profit

which I'm guessing is the primary use-case of numpy_financial (or maybe that was just me).

Anyway, there's still quite a bit of room for improvement. For example, by making mypy and pyright pass is strict mode. But getting there wll take quite a bit of effort for diminishing returns.


Closes #133

@jorenham jorenham marked this pull request as draft April 19, 2025 18:25
@jorenham jorenham added the CI label Apr 19, 2025
@jorenham jorenham marked this pull request as ready for review April 19, 2025 19:05
@jorenham jorenham added this to the 2.0 milestone Apr 20, 2025
@Kai-Striega
Copy link
Member

Thanks for including this, @jorenham it looks like great progress. I'm going to be busy this week, however I'll try to review it next weekend in depth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

static typing
2 participants